home *** CD-ROM | disk | FTP | other *** search
/ Aminet 50 / Aminet 50 (2002)(GTI - Schatztruhe)[!][Aug 2002].iso / Aminet / util / boot / ShellUpdate.lha / Documentation / SwapCD < prev    next >
Text File  |  2002-01-02  |  2KB  |  68 lines

  1. SwapCD
  2.  
  3. Format:        SWAPCD [<dir>]
  4. Template:    LEVEL/N,DIR/K
  5. Purpose:    Swap the top of the directory stack
  6. Path:        Internal
  7. Specification:    SWAPCD exchanges the top or the given level of the
  8.     directory stack with either the current directory, or the 
  9.     given directory should the directory be given.
  10.  
  11. The shell maintains a so-called directory stack of directories; items
  12. can be placed on this stack by means of "PUSHCD", and retrieved by
  13. "POPCD". SWAPCD is used to quickly switch between two directories, namely
  14. the top entry on this directory stack and the current working directory,
  15. or the specified directory.
  16.  
  17. SWAPCD with a given level exchanges not the top level, but the n-th level
  18. of the directory stack with the current directory. Hence, "SwapCD 2"
  19. exchanges the entry below the top of the directory stack with the current
  20. directory.
  21.  
  22.  
  23.  
  24. Examples:
  25.  
  26. Consider the current directory is SYS: and you change into SYS:Tools with
  27. the PUSHCD command:
  28.  
  29. 1.SYS:> pushcd Tools
  30.  
  31. This will place SYS: onto the directory stack and will make SYS:Tools the
  32. current directory.
  33.  
  34. Then, you can easely toggle between SYS: and SYS:Tools simply by SWAPCD:
  35.  
  36. 1.SYS:Tools> swapcd
  37.  
  38. will re-install SYS: as current directory and will place SYS: on top of the
  39. directory stack instead; a second SWAPCD will restore the above situation
  40. again:
  41.  
  42. 1.SYS:> swapcd
  43.  
  44. will therefore result in "SYS:Tools" as current directory again.
  45.  
  46. 1.SYS:Tools> 
  47.  
  48.  
  49. Consider that you now push another directory onto the directory stack:
  50.  
  51. 1.SYS:Tools> pushcd C:
  52.  
  53. resulting in the current directory C:
  54.  
  55. 1.SYS:C>
  56.  
  57. Now the top entry of the directory stack is "SYS:Tools", below we find
  58. "SYS:", the current directory is "SYS:C". Then
  59.  
  60. 1.SYS:C> swapcd 2
  61.  
  62. exchanges the current directory "SYS:C" with level 2 of the directory stack,
  63. which is "SYS:". Therefore, the result is
  64.  
  65. 1.SYS:> 
  66.  
  67. See also: PUSHCD, POPCD
  68.